﻿package frEngine.loaders.particleSub
{
    import frEngine.loaders.particleSub.particleInstance.*;

    public class CylinderEmitter extends EmitterObject
    {
        private var _topR:Number = 0;
        private var _bottomR:Number = 0;
        private var _H:Number = 0;

        public function CylinderEmitter(param1:Number, param2:Number, param3:Number, param4:String, param5:String)
        {
            this._topR = param1;
            this._bottomR = param2;
            this._H = param3;
            super(param4, param5);
            return;
        }// end function

        override public function get meshData() : MeshBase
        {
            if (!_meshData && !hasDisposed)
            {
                _meshData = new ConeData(this._bottomR, this._topR, this._H, 10);
            }
            return _meshData;
        }// end function

        override protected function processVolume(param1:int) : void
        {
            var _loc_8:Number = NaN;
            var _loc_2:* = randnomArr0[param1];
            var _loc_3:* = randnomArr1[param1];
            var _loc_4:* = randnomArr2[param1];
            var _loc_5:* = _loc_2;
            var _loc_6:* = this._H * _loc_5;
            _vect3d.y = _loc_6;
            var _loc_7:* = Math.PI * 2 * _loc_3;
            if (this._topR > this._bottomR)
            {
                _loc_8 = (this._topR - this._bottomR) * _loc_5 + this._bottomR;
            }
            else
            {
                _loc_8 = (this._bottomR - this._topR) * _loc_5 + this._topR;
            }
            var _loc_9:* = _loc_8 * _loc_4;
            _vect3d.x = _loc_9 * Math.sin(_loc_7);
            _vect3d.z = _loc_9 * Math.cos(_loc_7);
            return;
        }// end function

        override protected function processAxis(param1:int) : void
        {
            _vect3d.y = 0;
            _vect3d.x = 0;
            _vect3d.z = 0;
            return;
        }// end function

        override protected function processCurve(param1:int) : void
        {
            var _loc_2:* = randnomArr0[param1];
            var _loc_3:* = randnomArr1[param1];
            _vect3d.y = this._H * _loc_2;
            var _loc_4:* = Math.abs(this._bottomR - this._topR);
            var _loc_5:* = this._topR + (this._H - _vect3d.y) / this._H * _loc_4;
            var _loc_6:* = Math.PI * 2 * _loc_3;
            _vect3d.x = _loc_5 * Math.sin(_loc_6);
            _vect3d.z = _loc_5 * Math.cos(_loc_6);
            return;
        }// end function

        override protected function processEdage(param1:int) : void
        {
            var _loc_5:Number = NaN;
            var _loc_2:* = randnomArr1[param1];
            var _loc_3:* = randnomArr2[param1];
            var _loc_4:* = Math.PI * 2 * _loc_2;
            if (_loc_3 < 0.5)
            {
                _vect3d.y = this._H;
                _loc_5 = this._topR;
            }
            else
            {
                _vect3d.y = 0;
                _loc_5 = this._bottomR;
            }
            _vect3d.x = _loc_5 * Math.sin(_loc_4);
            _vect3d.z = _loc_5 * Math.cos(_loc_4);
            return;
        }// end function

        override protected function processVertex(param1:int) : void
        {
            this.processEdage(param1);
            return;
        }// end function

    }
}
